package com.zcf.interceptor;

import cn.hutool.core.util.StrUtil;
import com.zcf.utils.ThreadLocalUtil;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.util.StringUtils;
import org.springframework.web.servlet.HandlerInterceptor;

import java.util.Map;

/**
 * @author zcf
 */
public class LoginInterceptor implements HandlerInterceptor {

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        Map<String,Object> map = ThreadLocalUtil.get();
        if(map==null){
            response.setStatus(401);
            return false;
        }
        return true;
    }
}
